home *** CD-ROM | disk | FTP | other *** search
/ Euroscene 2 / Euroscene 2.iso / USEFUL / DeliTracker130 / Developer / Developer.run / Examples / Whittaker.s < prev   
Encoding:
Text File  |  1992-09-23  |  5.8 KB  |  265 lines

  1.  
  2.     ;-----------------------------
  3.     ; Whittaker-Play'routine' for DeliTracker
  4.     ;
  5.     ; this plays all WhittakerModules with these relativ
  6.     ; label addresses: init = $00; play = $04; end = $1c
  7.     ;
  8.     ; Anmerkung:
  9.     ; Whittakermodule die mit dem Ripper von 'Direct' gerippt wurden
  10.     ; sind um ca. 80 Byte zu kurz. Darum hört man beim Abspielen dieser
  11.     ; Module unangenehme (: Töne.
  12.     ; ( dies kann durch anhängen von 80 NULL-Bytes behoben werden)
  13.     ;
  14.     ; Also : Derartiges pfeifen wird NICHT durch dieses Playerinterface
  15.     ;  hervorgerufen.
  16.     ;-----------------------------
  17.     ; date : 26.05.91
  18.     ; by : Biohazard
  19.     ; on : DevPac Assembler V2(.30)d
  20.     ;-----------------------------
  21.  
  22.     ;-----------------------------
  23.     ; Changed to fit the new playerinterface, slight changes
  24.     ; by Delirium, but the most importent thing 
  25.     ; (recogition of subsongnumber) was done by Biohazard !!!
  26.     ; I got this routine from Biohazard on 16.01.1992
  27.     ; Thank you very much !
  28.  
  29.  
  30.     incdir    'includes:'
  31.     include    'misc/deliplayer.i'
  32.  
  33. Init        EQU $00
  34. Play        EQU $0e
  35. End        EQU $1c
  36.  
  37. ;
  38. ;
  39.     SECTION    Whittaker-Deli,CODE
  40. ;
  41. ;
  42.  
  43.     PLAYERHEADER PlayerTagArray
  44.  
  45.     dc.b '$VER: David Whittaker player module V2.7 (12 Sep 92)',0
  46.     even
  47.  
  48. PlayerTagArray
  49.     dc.l    DTP_PlayerVersion,5
  50.     dc.l    DTP_PlayerName,PlayerName
  51.     dc.l    DTP_Creator,Creator
  52.     dc.l    DTP_Check2,ChkFormat
  53.     dc.l    DTP_Interrupt,Int
  54.     dc.l    DTP_SubSongRange,SubSong
  55.     dc.l    DTP_InitPlayer,InitPlay
  56.     dc.l    DTP_EndPlayer,EndPlay
  57.     dc.l    DTP_InitSound,InitSnd
  58.     dc.l    DTP_EndSound,RemSnd
  59.     dc.l    DTP_PrevSong,PrevSub
  60.     dc.l    DTP_NextSong,NextSub
  61.     dc.l    TAG_DONE
  62.  
  63. ;------------------------------------------------------------------------------
  64.  
  65. PlayerName    dc.b    "Whittaker",0
  66. Creator        dc.b    "David Whittaker, adapted by Biohazard",0
  67.     even
  68.  
  69. ModuleAddr    dc.l    0            ; module address
  70. Cleanup        dc.l    0            ; cleanup routine
  71. Cleanup2    dc.l    0            ; buffer for checking
  72. MaxSong        dc.w    0            ; maximal subsongnumber
  73. MaxSong2    dc.w    0            ; buffer for checking
  74.  
  75. ;------------------------------------------------------------------------------
  76.  
  77. ChkFormat
  78.     move.l    dtg_ChkData(a5),a0        ; get moduladdress
  79.     move.l    dtg_ChkSize(a5),d0        ; and size
  80.  
  81.     cmpi.w    #$48e7,(a0)
  82.     bne.s    Unknown
  83.     cmpi.w    #$6100,4(a0)
  84.     bne.s    Unknown
  85.     cmpi.w    #$4cdf,8(a0)
  86.     bne.s    Unknown
  87.     cmpi.w    #$4e75,12(a0)
  88.     bne.s    Unknown
  89.  
  90.     cmpi.w    #$48e7,14(a0)
  91.     bne.s    Unknown
  92.     cmpi.w    #$6100,18(a0)
  93.     bne.s    Unknown
  94.     cmpi.w    #$4cdf,22(a0)
  95.     bne.s    Unknown
  96.     cmpi.w    #$4e75,26(a0)
  97.     beq.s    ChkFormat1
  98. Unknown    moveq    #-1,d0                ; module not known
  99.     bra    ChkEnd
  100. ChkFormat1
  101.     moveq    #28,d1
  102.     add.l    d1,a0                ; set moduladdress
  103.     sub.l    d1,d0                ; and size
  104. Check1    cmpi.w    #$43fa,(a0)
  105.     bne.s    Check2
  106.     cmpi.l    #$4880c0fc,4(a0)
  107.     bne.s    Check2
  108.     cmpi.w    #$41fa,10(a0)
  109.     beq.s    ChkFormat2
  110. Check2    addq.l    #2,a0
  111.     subq.l    #2,d0
  112.     bpl.s    Check1
  113.     bra.s    Unknown
  114. ChkFormat2
  115.     move.l    a0,a1                ; copy moduladdress
  116.     move.l    d0,d1                ; and size
  117. Check3    cmpi.w    #$47fa,(a1)
  118.     bne.s    Check4
  119.     cmpi.w    #$51eb,4(a1)
  120.     bne.s    Check4
  121.     cmpi.w    #$51eb,8(a1)
  122.     beq.s    FindLastSong
  123.     cmpi.w    #$33fc,8(a1)
  124.     beq.s    FindLastSong
  125. Check4    addq.l    #2,a1
  126.     subq.l    #2,d1
  127.     bpl.s    Check3
  128.     bra.s    Unknown
  129. FindLastSong
  130.     move.l    a1,Cleanup2
  131.  
  132.     move.w    2(a1),d1
  133.     lea    2-12(a1,d1.w),a1
  134.     move.l    a0,d1
  135.     sub.l    a1,d1
  136.     move.w    12(a0),d2            ; offset for Whittaker_Array
  137.     moveq    #0,d3                ; test-offset
  138.     move.w    #$7fff,d4            ; max. offset
  139.     moveq    #-1,d5                ; song counter
  140.  
  141. TryNext    move.w    8(a0),d0            ; Array Size
  142.     lsr.w    #1,d0
  143.     subq.w    #1,d0
  144.     addq.w    #2,d2
  145. TryLoop    move.w    12(a0,d2.w),d3            ; get offset
  146.     btst    #0,d3
  147.     bne.s    TryEnd                ; until odd
  148.     sub.w    d1,d3
  149.     cmp.w    d4,d3
  150.     bge.s    TryOk
  151.     move.w    d3,d4
  152. TryOk    cmp.w    d4,d2
  153.     bge.s    TryEnd                ; until array end
  154.     addq.w    #2,d2
  155.     subq.w    #1,d0
  156.     bne.s    TryLoop
  157.     addq.l    #1,d5                ; MaxSong+1
  158.     bra.s    TryNext
  159. TryEnd    move.w    d5,MaxSong2            ; store MaxSong
  160.  
  161.     moveq    #0,d0                ; we can play this song :-)
  162. ChkEnd    rts
  163.  
  164. ;------------------------------------------------------------------------------
  165. ;
  166. ; Set min. & max. subsong number
  167.  
  168. SubSong
  169.     moveq    #0,d0                ; min.
  170.     move.w    MaxSong(pc),d1            ; max.
  171.     rts
  172.  
  173. ;------------------------------------------------------------------------------
  174. ;
  175. ; Init Player
  176.  
  177. InitPlay
  178.     moveq    #0,d0                ; (file 0)
  179.     move.l    dtg_GetListData(a5),a0        ; get the module address
  180.     jsr    (a0)
  181.     move.l    a0,ModuleAddr            ; and store it
  182.  
  183.     move.l    Cleanup2(pc),Cleanup        ; copy buffer
  184.     move.w    MaxSong2(pc),MaxSong        ; copy buffer
  185.  
  186.     move.l    dtg_AudioAlloc(a5),a0        ; allocate the audiochannels
  187.     jsr    (a0)                ; returncode is already set !
  188.     rts
  189.  
  190. ;------------------------------------------------------------------------------
  191. ;
  192. ; End Player
  193.  
  194. EndPlay
  195.     move.l    dtg_AudioFree(a5),a0        ; deallocate the audiochannels
  196.     jsr    (a0)
  197.     rts
  198.  
  199. ;------------------------------------------------------------------------------
  200.  
  201. InitSnd    
  202.     move.l    ModuleAddr(pc),a0        ; ^module
  203.     moveq    #0,d0                ; for clearing the upper 16 bits
  204.     move.w    dtg_SndNum(a5),d0        ; dtg_SndNum
  205.     jsr    Init(a0)            ; init
  206.     rts
  207.  
  208. ;------------------------------------------------------------------------------
  209.  
  210. RemSnd
  211.     move.l    Cleanup(pc),a0
  212.     moveq    #0,d0
  213.     jsr    (a0)                ; call the cleanup function
  214.     rts
  215.  
  216. ;------------------------------------------------------------------------------
  217. ;
  218. ; Previous SubSong
  219.  
  220. PrevSub
  221.     tst.w    dtg_SndNum(a5)            ; first subsung ?
  222.     beq.s    PrevSubEnd
  223.  
  224.     move.l    dtg_StopInt(a5),a0        ; remove interrupt
  225.     jsr    (a0)
  226.     bsr    RemSnd
  227.     subq.w    #1,dtg_SndNum(a5)        ; prev sound
  228.     bsr    InitSnd
  229.     move.l    dtg_StartInt(a5),a0        ; restart interrupt
  230.     jsr    (a0)
  231. PrevSubEnd
  232.     rts
  233.  
  234. ;------------------------------------------------------------------------------
  235. ;
  236. ; Next SubSong
  237.  
  238. NextSub
  239.     move.w    dtg_SndNum(a5),d0        ; dtg_SndNum
  240.     cmp.w    MaxSong(pc),d0            ; max. subsongnumber reached?
  241.     bge.s    NextSubEnd            ; yes, then exit ...
  242.  
  243.     move.l    dtg_StopInt(a5),a0
  244.     jsr    (a0)
  245.     bsr    RemSnd
  246.     addq.w    #1,dtg_SndNum(a5)        ; next sound
  247.     bsr    InitSnd
  248.     move.l    dtg_StartInt(a5),a0
  249.     jsr    (a0)
  250. NextSubEnd
  251.     rts
  252.  
  253. ;------------------------------------------------------------------------------
  254.  
  255. Int
  256.     movem.l    d0-d7/a0-a6,-(sp)
  257.     move.l    ModuleAddr(pc),a0
  258.     moveq    #0,d0
  259.     jsr    Play(a0)
  260.     movem.l    (sp)+,d0-d7/a0-a6
  261.     rts
  262.  
  263. ;------------------------------------------------------------------------------
  264.  
  265.